/*     */ package pck_tramitedocu.pck_src.pck_utiles;
/*     */ 
/*     */ import java.io.ByteArrayOutputStream;
/*     */ import java.util.logging.Level;
/*     */ import java.util.logging.Logger;
/*     */ import net.sf.jasperreports.engine.JRException;
/*     */ import net.sf.jasperreports.engine.JRExporterParameter;
/*     */ import net.sf.jasperreports.engine.JasperPrint;
/*     */ import net.sf.jasperreports.engine.export.JRCsvExporter;
/*     */ import net.sf.jasperreports.engine.export.JRHtmlExporter;
/*     */ import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
/*     */ import net.sf.jasperreports.engine.export.JRPdfExporter;
/*     */ import net.sf.jasperreports.engine.export.JRRtfExporter;
/*     */ import net.sf.jasperreports.engine.export.JRXlsExporter;
/*     */ import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
/*     */ import net.sf.jasperreports.engine.export.JRXmlExporter;
/*     */ import net.sf.jasperreports.engine.export.JRXmlExporterParameter;
/*     */ 
/*     */ public final class cls_jasper_export
/*     */ {
/*     */   public static byte[] xmlReportToArray(JasperPrint jasperPrint)
/*     */   {
/*  26 */     byte[] bytes = null;
/*     */     try {
/*  28 */       JRXmlExporter jasperXmlExportMgr = new JRXmlExporter();
/*     */ 
/*  30 */       ByteArrayOutputStream xmlReport = new ByteArrayOutputStream();
/*  31 */       jasperXmlExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/*  32 */       jasperXmlExportMgr.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.TRUE);
/*  33 */       jasperXmlExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, xmlReport);
/*  34 */       jasperXmlExportMgr.exportReport();
/*  35 */       bytes = xmlReport.toByteArray();
/*     */     } catch (JRException jex) {
/*  37 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/*  39 */     return bytes;
/*     */   }
/*     */ 
/*     */   public static byte[] csvReportToArray(JasperPrint jasperPrint)
/*     */   {
/*  48 */     byte[] bytes = null;
/*     */     try {
/*  50 */       JRCsvExporter jasperCsvExportMgr = new JRCsvExporter();
/*     */ 
/*  52 */       ByteArrayOutputStream csvReport = new ByteArrayOutputStream();
/*  53 */       jasperCsvExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/*     */ 
/*  55 */       jasperCsvExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, csvReport);
/*  56 */       jasperCsvExportMgr.exportReport();
/*  57 */       bytes = csvReport.toByteArray();
/*     */     } catch (JRException jex) {
/*  59 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/*  61 */     return bytes;
/*     */   }
/*     */ 
/*     */   public static byte[] htmlReportToArray(JasperPrint jasperPrint)
/*     */   {
/*  70 */     byte[] bytes = null;
/*     */     try {
/*  72 */       JRHtmlExporter jasperHtmlExportMgr = new JRHtmlExporter();
/*     */ 
/*  74 */       ByteArrayOutputStream htmlReport = new ByteArrayOutputStream();
/*  75 */       jasperHtmlExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/*  76 */       jasperHtmlExportMgr.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
/*     */ 
/*  78 */       jasperHtmlExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, htmlReport);
/*  79 */       jasperHtmlExportMgr.exportReport();
/*  80 */       bytes = htmlReport.toByteArray();
/*     */     } catch (JRException jex) {
/*  82 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/*  84 */     return bytes;
/*     */   }
/*     */ 
/*     */   public static byte[] pdfReportToArray(JasperPrint jasperPrint)
/*     */   {
/*  93 */     byte[] bytes = null;
/*     */     try {
/*  95 */       JRPdfExporter jasperPdfExportMgr = new JRPdfExporter();
/*     */ 
/*  97 */       ByteArrayOutputStream pdfReport = new ByteArrayOutputStream();
/*  98 */       jasperPdfExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/*     */ 
/* 100 */       jasperPdfExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, pdfReport);
/* 101 */       jasperPdfExportMgr.exportReport();
/* 102 */       bytes = pdfReport.toByteArray();
/*     */     } catch (JRException jex) {
/* 104 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/* 106 */     return bytes;
/*     */   }
/*     */ 
/*     */   public static byte[] xlsReportToArray(JasperPrint jasperPrint)
/*     */   {
/* 115 */     byte[] bytes = null;
/*     */     try {
/* 117 */       JRXlsExporter jasperXlsExportMgr = new JRXlsExporter();
/*     */ 
/* 119 */       ByteArrayOutputStream xlsReport = new ByteArrayOutputStream();
/* 120 */       jasperXlsExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/* 121 */       jasperXlsExportMgr.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
/* 122 */       jasperXlsExportMgr.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
/* 123 */       jasperXlsExportMgr.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE);
/* 124 */       jasperXlsExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, xlsReport);
/* 125 */       jasperXlsExportMgr.exportReport();
/* 126 */       bytes = xlsReport.toByteArray();
/*     */     }
/*     */     catch (JRException jex) {
/* 129 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/* 131 */     return bytes;
/*     */   }
/*     */ 
/*     */   public static byte[] rtfReportToArray(JasperPrint jasperPrint)
/*     */   {
/* 140 */     byte[] bytes = null;
/*     */     try {
/* 142 */       JRRtfExporter jasperRtfExportMgr = new JRRtfExporter();
/*     */ 
/* 144 */       ByteArrayOutputStream rtfReport = new ByteArrayOutputStream();
/* 145 */       jasperRtfExportMgr.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
/*     */ 
/* 147 */       jasperRtfExportMgr.setParameter(JRExporterParameter.OUTPUT_STREAM, rtfReport);
/* 148 */       jasperRtfExportMgr.exportReport();
/* 149 */       bytes = rtfReport.toByteArray();
/*     */     } catch (JRException jex) {
/* 151 */       Logger.getLogger(cls_jasper_export.class.getName()).log(Level.SEVERE, null, jex);
/*     */     }
/* 153 */     return bytes;
/*     */   }
/*     */ }

/* Location:           /media/Datos/tramitedocuweb_bkD/WEB-INF/classes/
 * Qualified Name:     pck_tramitedocu.pck_src.pck_utiles.cls_jasper_export
 * JD-Core Version:    0.6.0
 */